<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="5" :sm="8">
            <a-form-model-item label="部门" prop="deptName">
              <j-input v-model="queryParam.deptName" type="like"/>
            </a-form-model-item>
          </a-col>
          <a-col :md="8" :sm="8">
            <a-form-model-item label="所属公司" prop="company">
              <j-dict-select-tag
                v-model="queryParam.company"
                dictCode="company_code"
                placeholder="请选择所属公司">
              </j-dict-select-tag>
              
            </a-form-model-item>
          </a-col>
          <a-col :md="5" :sm="8">
            <a-form-item label="日期">
              <a-month-picker style="width: 100%;" v-model="queryParam.startTime" placeholder="请选择年月"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 modalForm-->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
        :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">
        <!-- <span slot="preliminaryBadNum" slot-scope="text, record">
          <a @click="checkHandle(record)">{{record.preliminaryBadNum}}</a>
        </span> -->
        <span slot="action" slot-scope="text, record" style="width:100px;height:17px;">
          <!-- <a @click="handleExport(record)">导出</a> -->
          <!-- <span v-if="record.assetsNum == record.preliminaryBadNum">暂无数据</span> -->
          <a @click="handleExport(record.billNo)">在线查看</a>
          <a-divider type="vertical" />
          <a href="#" style="position: relative;overflow: hidden;">
              <iframe style="position: absolute;overflow: hidden;left: 0;bottom:0px;border:none;"  width="50px" height="17px"
                      :src="reportUrl+'&billNo='+record.billNo">
              </iframe>
          </a>
        </span>

      </a-table>
    </div>
    <AssetCheck-modal ref="modalForm1" @ok="modalFormOk"></AssetCheck-modal>
    <AssetStart-modal :isAudit="isAudit" ref="modalForm" @ok="modalFormOk"></AssetStart-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import AssetStartModal from './modules/AssetStartModal'
import AssetCheckModal from './modules/AssetCheckModal'
import moment from 'moment'


export default {
  name: 'AssetStartList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    AssetStartModal,
    AssetCheckModal
  },
  data() {
    this.dateFormat = 'YYYY-MM-DD';
    return {
      reportUrl: 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco%252Fmarkefront%252Fassets_index.cpt&ref_t=design',
      reportUrlPrint: 'https://bi.flyco.net.cn/webroot/decision/view/report?viewlet=flyco%252Fmarkefront%252Fassets_print.cpt&ref_t=design',
      queryParam:{
        startTime:moment(new Date()).format('YYYY-MM')
      },
      description: '初盘',
      isAudit:0,
      searchOptions:[{
          text:"全部",
          value:"1"
        },{
          text:"在职",
          value:"2"
        },{
          text:"离职",
          value:"3"
      }],
      // 表头
      columns: [
        {
          title: '单据编号',
          align: "center",
          dataIndex: 'billNo'
        },
        {
          title: '部门名称',
          align: "center",
          dataIndex: 'deptName'
        },
        {
          title: '资产数量',
          align: "center",
          dataIndex: 'assetsNum'
        },
        {
          title: '初盘异常数量',
          align: "center",
          dataIndex: 'preliminaryBadNum'
        },
        {
          title: '复盘异常数量',
          align: "center",
          dataIndex: 'doubleQuotationBadNum'
        },
        {
          title: '盘点开始时间',
          align: "center",
          dataIndex: 'startTime'
        },
        {
          title: '盘点结束时间',
          align: "center",
          dataIndex: 'endTime'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/assets/assetsPreliminaryResults/list",
        delete: "/sys/user/delete",
      },
    }
  },
  created() {
  },
  computed: {
  },
  methods: {
    moment,
    handleExport:function(billNo){
      window.open(this.reportUrlPrint+'&billNo='+billNo)
    },
    checkHandle(record){
      this.$refs.modalForm1.edit(record);
      this.$refs.modalForm1.title = "详情";
      this.$refs.modalForm1.disableSubmit = false;
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>